#ifndef LOADING_MODULE
#define LOADING_MODULE

#include "Hw3Types.h"
#include "Hw3TypesExtended.h"


/*oOoOoOoOoOoOoOoOoOoOoOoOooOoOoOoOoOoO*/
//	Loading Module
/*oOoOoOoOoOoOoOoOoOoOoOoOooOoOoOoOoOoO*/
// This module is in charge of loading the picture, retrieving its parameters and dividing it to areas.

// OpenImageAndGetProperties
// =========================
// This function opens the image file reader and retrievs important information about the picture, such as Height, 
// Width, Pitch and Padding. 
// NOTE: This function allocates memory to store the image reader, so the function CloseImageReaderAndProperties 
//			must be called before the program has finished running.
// Inputs:
//		- A constant string with the image's file name. 
// Output: 
//		- The returned values are stored in the global ImageReaderAndProperties variable, 
//			so it must be created before calling this function.
//		- The function returns TRUE on success and FALSE on failure.
BOOL OpenImageAndGetProperties(const char* ImageFileName);

// CloseImageReaderAndProperties
// =============================
// This function closes the image file reader and frees the allocated memory. It must be called before ending the
// program. It uses the global ImageReaderAndProperties as input, so no additional inputs are needed.
void CloseImageReaderAndProperties();

// DividePicToAreas
// ================
// This function devides the picture to areas based on the division instructions provided in the exercise. 
// Basically, the function devides the picture into NumOfAreasHorizontal horizontal areas and NumOfAreasVertical 
// vertical areas, such that no two areas are overlaping, and each box in the image belongs to exactly one area.
// The areas are "almost" the same size - the last area in each row/column can be slightly larger than the other 
// areas in the row/column. 
// TIP: After deviding the picture into areas, you can use the PrintAreasDivision function from the TestFunctions
//		module to get a visualization of the division.
// Inputs:
//		- NumOfAreasHorizontal - Number of horizontal areas.
//		- NumOfAreasVertical - Number of vertical areas.
// Output:
//		- The function returns a pointer to an array of TArea elements, each containing the relevant information on 
//			the area. 
// NOTE: The function allocates memory to the areas array. This memory must be freed by the user before ending 
//			the program.
TArea *DividePicToAreas(int NumOfAreasHorizontal, int NumOfAreasVertical);

#endif